﻿
CREATE FUNCTION dbo.fverTree_TextAttr
	(
	@Lable varchar(512),
	@Checked bit,
	@CoolTip varchar(4000),
	@MsgToBroker varchar(1024),
	@MsgToBoss varchar(1024)
	)
RETURNS varchar(8000)
AS
BEGIN
DECLARE @Class varchar(128), @IsChecked sysname,@Out varchar(8000),
				@Img varchar(1024),@ImgUrl varchar(128)

SET @Class = 'checked'
IF @Checked = 0 SET @Class = 'un'+@Class

SET @Out = '
<SPAN class=checked oncontextmenu="return showNodeMenu()"
onmouseover="try{toolTip.element=this}catch(e){}"
coolTip='''+ISNULL(NULLIF(@CoolTip,''),@Lable)+'''
style="vertical-align:middle;margin-left:2px"
onclick="showPages(this)"
>'+@Lable+'</SPAN>';

SET @ImgUrl = '/images/EnvelopOpened.gif'
IF ISNULL(@MsgToBroker,'') > '' OR ISNULL(@MsgToBoss,'') > '' SET @ImgUrl = '/images/EnvelopClosed.gif'

SET @Img = 
'<IMG src="'+@ImgUrl+'" style="vertical-align:middle"
	onclick="messageToBroker(this)"
	style="margin:1px" oncontextmenu="return false"
	onmouseover="overImage(this);setMsgCoolTip(this);toolTip.element=this;event.cancelBubble=true;return false;"
>'

RETURN @Img + @Out

END

